<?php 
namespace app\index\model;
use think\Model;

class Owner extends Model {

	public function getStatusCnAttr($value,$data)
    {
        $status = [1=>'已验证',2=>''];
        return $status[$data['status']];
    }


    public function getNewroomAttr($value,$data){
        $appartment=(string)$data['appartment'];
        $roomStr=substr($appartment,-2);
        $roomInt=(int)$roomStr;
        $floor= (string)$data['floor'];
        $unit='';
        $room='';
        if($roomInt>=5){
            $unit='1-';
            switch ($roomStr) {
                case '08':
                   $room='01';
                    break;
                case '07':
                    $room='02';
                        break;
                case '06':
                    $room='03';
                        break;
                case '05':
                    $room='04';
                        break;
                default:
                    # code...
                    break;
            }
        }else{
            $unit="2-";
            switch ($roomStr) {
                case '04':
                   $room='01';
                    break;
                case '03':
                    $room='02';
                        break;
                case '02':
                    $room='03';
                        break;
                case '01':
                    $room='04';
                        break;
                default:
                    # code...
                    break;
        }
    }
    return $newRoom=$unit.$floor.$room;
}
	
}